<template>
  <div>
    我是C组件(接收方)
    <p>{{ msg }}</p>
  </div>
</template>

<script>
import Bus from "../utils/EventBus";
export default {
  created() {
    // 2. 监听Bus组件的sendMsg事件，当时事件被触发，执行回调函数
    Bus.$on("sendMsg", msg => {
      // console.log(" 组件收到消息：", msg);
      this.msg = msg;
    });
  },
  data() {
    return { msg: "" };
  }
};
</script>

<style scoped>
div {
  width: 150px;
  height: 80px;
  border: 3px solid #000;
  padding: 10px;
  margin: 10px;
}
</style>